<?php
include ROOT .'/include/class/split_page_results.php';
if(isset($_GET['category_id']) && intval($_GET['category_id'])){
  $category_id = intval($_GET['category_id']);
  $category    = db_fetch("select * from category where status = 'visiable' and id = '" . $category_id ."'");
  $title       = $category['name'];
} else {
  /* for xrz */
  forward404();
  /* end for */
  $category_id = 0;
  $title       = '全部商品';
}
# categories list
# comment for xrz
# $categories = get_categories_by_parent_id($category_id);
define('MAX_DISPLAY_SEARCH_RESULTS', 9);
define('MAX_DISPLAY_PAGE_LINKS', 5);
# products list
$listing_sql = "select * from product where status='visiable' and category_id='" . $category_id . "' order by sort_order desc";
$listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS);
//$products = get_products_by_category_id($category_id);
//echo $listing_sql;
$products = db_fetch_all($listing_split->sql_query);


include get_template('index');